#include <raylib.h>

int main() {
	
	InitWindow(800,600,"世界你好");
	
	Image img=GenImageColor(800,600,WHITE);
	
	//读取字体文件
	unsigned int fileSize;
	unsigned char *fontFileData = LoadFileData("fonts/LXGWWenKaiMonoScreen.ttf", &fileSize);
	
	//ImageDrawCircleEx(&img, 400,300,200,10,BLACK);
	SetTraceLogLevel(LOG_WARNING);
	SetTargetFPS(120);
	while (!WindowShouldClose()) {
		//将要输出的内容放到字符串中（必须是utf8编码）
		char text[]="世界，你好！";
		// 将字符串中的字符逐一转换成Unicode码点，得到码点表
		int codepointsCount;
		int *codepoints=LoadCodepoints(text,&codepointsCount);
		// 读取仅码点表中各字符的字体
		Font font = LoadFontFromMemory(".ttf",fontFileData,fileSize,32,codepoints,codepointsCount);
		// 释放码点表
		UnloadCodepoints(codepoints);
		BeginDrawing();
		ClearBackground(WHITE);
		DrawTextEx(font,text,(Vector2){50,50},32,5,RED);
		DrawTextEx(font,"hahha",(Vector2){80,1000},32,5,RED);
		DrawTextEx(font,text,(Vector2){50,50},53,5,RED);
		DrawTextEx(font,"hahha",(Vector2){80,1000},32,5,RED);
		EndDrawing();
		//释放字体
		UnloadFont(font);
	}
	UnloadImage(img);
	//释放字体文件内容
	UnloadFileData(fontFileData);
	return 0;
}